/**
 * Created by vincent on 2017/10/12.
 */
moduleStudyMap.controller("EditEventController", function ($$CambioConfig, $scope, $log, $state, LoadingService,
                                                           ConstantService, DialogService, EventResource) {
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        if ($scope.editEventForm.$valid) {
            //LoadingService.show();
            EventResource.update($scope.editingEvent, function (result) {
                $log.debug("活动更新结果", result);
                angular.copy(result, $scope.currentEvent);
                DialogService.close();
                //LoadingService.hide();
                Alert.success("更新互动成功！");
            }, function () {
                //LoadingService.hide();
            });
        }
    };
});